package com.sicheng.metadata.juc.forkjoin;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.ForkJoinTask;

public class ForkJoinApp {
    public static void main(String[] args) {
        ForkJoinPool pool = new ForkJoinPool();
        long start = System.currentTimeMillis();
        ForkJoinTask<Long> task = pool.submit(new CustomTask(0L, 10_0000_0000L));
        try {
            System.out.println(task.get());
            long end = System.currentTimeMillis();
            System.out.println((end-start)+"ms");
            pool.shutdown();
        } catch (InterruptedException | ExecutionException e) {
            e.printStackTrace();
        }
    }

}
